/**
 * Created by lins on 2018-7-11.
 */
(function (angular) {
    function LabelSysService($resource, $q, $http, UrlConfigService) {
        var _schema = [
            {label: '序号', name: "id", sortable: false},
            {label: '名称', name: "name", sortable: false},
            {label: '数据类型', name: "type", sortable: false},
            {label: '数据来源', name: "source", sortable: false},
            {label: '操作', type: 'template', templateUrl: 'operation.html', width: '120px'}
        ];
        this._schema = _schema;
        this._sort = '';
        this._order = '';
        this._listUrl = UrlConfigService.urlConfig. decisionAnalysis.portray.labelSystem.list;
        this._url = '';
        this._businessUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.business;
        this._pollutionUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.pollution;
        this._basicUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.basic;
        this._countUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.count;
        this._benefitUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.benefit;
        this._influenceUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.influence;
        this._creditUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.credit;
        this._weatherUrl = UrlConfigService.urlConfig.decisionAnalysis.portray.labelSystem.weather;
        BaseListService.call(this, this._listUrl, $resource, $q, $http, _schema, this._url);

        this.getUrl = function (index) {
            this.indexUrl = null;
            if(index == 0){
                this.indexUrl = this._listUrl;
            }else if(index==1){
                this.indexUrl = this._pollutionUrl;
            }else if(index==2){
                this.indexUrl = this._businessUrl;
            }else if(index==3){
                this.indexUrl = this._basicUrl;
            }else if(index==4){
                this.indexUrl = this._countUrl;
            }else if(index==5){
                this.indexUrl = this._benefitUrl;
            }else if(index==6){
                this.indexUrl = this._influenceUrl;
            }else if(index==7){
                this.indexUrl = this._creditUrl;
            }else if(index==8){
                this.indexUrl = this._weatherUrl;
            }
            return this.$resource(this.indexUrl).get();
        };

    }

    LabelSysService.$inject = ['$resource', '$q', '$http', 'UrlConfigService'];
    angular.module('MetronicApp').service('LabelSysService', LabelSysService);
})(angular);